package com.wu.framework.http;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * description mybatis 分页查询参数
 * @author 吴佳伟
 * @date 2021/5/25 2:25 下午
 */
public class PageBO {

    public PageBO(Integer current, Integer size) {
        this.current = current;
        this.size = size;
    }

    @ApiModelProperty(hidden = true)
    protected Page page;
    /**
     * 当前页数
     */
    @Setter
    @Getter
    @ApiModelProperty(value = "当前页数", example = "1", required = true)
    private Integer current;
    /**
     * 每页条数
     */
    @Setter
    @Getter
    @ApiModelProperty(value = "每页条数", example = "10", required = true)
    private Integer size;

    // 转换成分页
    public Page convert2Page() {
        if (null == page) {
            page = new Page(current, size);
        }
        return page;
    }
}
